<div id="sidetabs_body_container">

    <div class="main_container" style="padding: 10px 0;">
    <?php if(in_array($this->session->userdata('level'), array(1,2))):?>
        <?php $attr = array('id' => 'submitOnChange');echo form_open('', $attr)?>
        
            <?php if(in_array($this->session->userdata('level'), array(1,2))):?>
            <table class="s3basicedit wiform">
               <tbody>
                  <tr>
                     <td style="width: 35%;"><strong>Chọn nhóm mạng:</strong></td>
                     <td>
                        <?php echo $fview->selectOption($group, $id, 'w99', 'group_id', 'group');?>
                     </td>
                  </tr>
                </tbody>
            </table>
            </form>
            <?php endif;?>
            
            <div class="treeNetwork">
            <?php if(!in_array($data, array(null, '', '0'))):?>
                <?php foreach($data AS $key => $value):?>
                <div class="boxC1">
                    <div class="province toggle show"><?php echo $value->name?></div>
                    <div class="block">
                        <?php foreach($value->district AS $keys => $values):?>
                        <div class="boxC2">
                            <div class="district toggle show"><?php echo $values->name?></div>
                            <div class="block">
                                <?php foreach($values->address AS $keyss => $valuess):?>
                                <div class="boxC3">
                                    <div class="address"><?php echo $valuess->name.' - '.$valuess->address?></div>
                                    <?php foreach($valuess->device AS $keysss => $valuesss):?>
                                    <div class="boxC4">
                                        <div class="device" style="margin-bottom: 6px;">
                                            <b><?php echo $valuesss->namedevice;?></b>
                                            <img alt="" src="<?php echo site_url()?>assets/images/<?php if((time()- $valuesss->time_update) >= 300):?>offline<?php else:?>online<?php endif;?>.png"/>
                                            <a style="padding: 5px 7px!important" class="btn btn-info" href="<?php echo 'http://wicity.vn/homepage/?res=notyet&uamip=10.20.32.1&uamport=3990&challenge=dc11415464105f45350c714a554570ea&called='.$valuesss->nasid.'&mac=admin&ip=10.20.32.5&nasid='.$valuesss->nasid.'&sessionid=551b4a4a00000002&userurl=wicity.vn&md=F30685413AE549565FA4392F944F8AB8';?>" target="_blank"><i class="fa fa-share"></i></a>
                                            <a style="padding: 5px 7px!important" class="btn btn-info" href="#" target="_blank"><i class="fa fa-cog"></i></a>
                                        </div>
                                        <div class="info">
                                            <div>MAC : <?php echo $valuesss->mac;?></div>
                                            <div>NasID : <?php echo $valuesss->nasid;?></div>
                                            <div><?php echo 'Online cuối : '.date('H:i:s d/m/Y', $valuesss->time_update);?></div>
                                        </div>
                                    </div>
                                    <?php endforeach;?>
                                </div>
                                <?php endforeach;?>
                            </div>
                        </div>
                        <?php endforeach;?>
                    </div>
                </div> 
                <?php endforeach;?>
            <?php else:?>
                <?php if( $id != 0 ):?>
                <div class="boxC1">Không có thiết bị nào thuộc nhóm mạng này!</div>
                <?php endif;?>
            <?php endif;?>
            </div>
    <?php else:?>
            <div style="font-size: 152px;font-weight: bold;display: block;text-align: center;padding-top: 120px;">WICITY</div>
    <?php endif;?>
    </div>
    
</div>
<script type="text/javascript">
    $(document).ready(function(){
        $(document).on('change', '#group', function(){
            if($(this).val() != 0)
            {
                document.getElementById("submitOnChange").submit();
            }
        });
    });
</script>